package com.woniu.secondhand.controller;

import com.woniu.common.annotation.LoginUser;
import com.woniu.common.entity.Result;
import com.woniu.secondhand.service.ISecondhandAccessService;
import com.woniu.user.vo.UserLoginVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author HMMT
 * @since 2023-05-22
 */
@RestController
@RequestMapping("/secondhandAccess")
@Api(tags = "访问管理")
@Slf4j
public class SecondhandAccessController {
    @Autowired
    private ISecondhandAccessService accessService;

    @PostMapping("/add/{productId}")
    @ApiOperation("添加访问信息")
    public Result addAccess(@PathVariable Integer productId, @LoginUser UserLoginVO userLoginVO) {
        int row = accessService.addAccess(productId, userLoginVO);
        return Result.commonByRow(row);
    }
}
